package cn.jsl.controller;

import cn.jsl.entity.User;
import cn.jsl.feign.UserFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {
    @Autowired
    private UserFeign userFeign;

    @GetMapping("/getUserById/{id}")
    public User getUserById(@PathVariable("id") Long id){
        //使用feign来调用User里面的controller来获取用户信息
        //要用feign先要导包  starter-openfeign包
        //启动类需要启用openfeign  enableFeignClients
        return userFeign.getUserById(id);

    }
}
